{
  open Parser        (* The type token is defined in parser.mli *)
  exception Eof
}
let digit = ['0'-'9']
let ext = ['+' '-' '.' '*' '/' '<' '=' '>' '!' '?' ':' '$' '%' '_' '&' '~' '^']
let alpha = ['a'-'z' 'A'-'Z' ]
rule token = parse
  [';'] [^'\n']* ['\n']          { token lexbuf }     (* skip comments *)
| [' ' '\t' '\n']                { token lexbuf }     (* skip blanks *)
| ['-']? digit* ['.'] digit*     { FLOAT(float_of_string(Lexing.lexeme lexbuf)) }
| ['-']? digit+                  { INT(int_of_string(Lexing.lexeme lexbuf)) }
| "#t"                           { BOOL(true)}
| "#f"                           { BOOL(false)}
| (alpha|ext) (digit|alpha|ext)* { SYMBOL(Lexing.lexeme lexbuf) }
| '"' ([^'"']* as str) '"'       { STRING(str) }
| ['\'']                         { QUOTE }
| '('                            { LPAREN }
| ')'                            { RPAREN }
| eof                            { raise Eof }
